// @ts-ignore
/* eslint-disable */
import { request } from "@/utils/request";

/** 修改密码 修改当前登录管理员的密码 POST /admin/auth/change-password */
export async function adminAuthChangePassword(
  body: API.ChangePasswordRequest,
  options?: { [key: string]: any }
) {
  return request<any>(`/admin/auth/change-password`, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
    },
    data: body,
    ...(options || {}),
  });
}

/** 退出登录 撤销当前访问令牌 POST /admin/auth/logout */
export async function adminAuthLogout(options?: { [key: string]: any }) {
  return request<any>(`/admin/auth/logout`, {
    method: "POST",
    ...(options || {}),
  });
}

/** 获取当前用户信息 获取当前登录管理员的详细信息 GET /admin/auth/profile */
export async function adminAuthProfile(options?: { [key: string]: any }) {
  return request<API.Response & { data?: API.User }>(`/admin/auth/profile`, {
    method: "GET",
    ...(options || {}),
  });
}

/** 刷新访问令牌 使用刷新令牌获取新的访问令牌 POST /admin/auth/refresh */
export async function adminAuthRefresh(
  body: API.RefreshTokenRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.TokenResponse }>(
    `/admin/auth/refresh`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 管理员登录 管理员用户登录接口 POST /api/v1/admin/auth/login */
export async function apiV1AdminAuthLogin(
  body: API.LoginRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.TokenResponse }>(
    `/api/v1/admin/auth/login`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 管理员注册 创建新的管理员账户 POST /api/v1/admin/auth/register */
export async function apiV1AdminAuthRegister(
  body: API.RegisterRequest,
  options?: { [key: string]: any }
) {
  return request<API.Response & { data?: API.User }>(
    `/api/v1/admin/auth/register`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}
